sap.ui.define([
	"sap/ui/core/mvc/Controller",
	"sap/ui/model/json/JSONModel",
], function (Controller, JSONModel) {
	"use strict";

	return Controller.extend("autofiror.reuse.routepatterns.controller.Pattern1", {
		onInit() {
			const oRouter = this.getOwnerComponent().getRouter();
			oRouter.getRoute("pattern1").attachPatternMatched(this._onObjectMatched, this);
			// 路径
		},

		_onObjectMatched(oEvent) {
			var oArgs = oEvent.getParameter("arguments");
			let par = {
				pars: JSON.stringify(oArgs)
			}
			const oModel = new JSONModel(par);
			this.getView().setModel(oModel, 'par');
		},

		onNavBack() {
			const oRouter = this.getOwnerComponent().getRouter();
			oRouter.navTo("show");
			oRouter.parse("");
		},

		// goPattern2() {
		// 	const oRouter = this.getOwnerComponent().getRouter();
		// 	oRouter.navTo("pattern2", {
		// 		"MandatoryProductId": "5",
        //         "restAsString*": "Detail"
		// 	});
		// 	oRouter.parse("Product/5/Detail");
		// },
	});
});